<?php $this->load->view('admin/public/head.html', array('css' => array(
'/assets/admin/css/admin/common.css'
))); ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper" ng-controller="admin-bbs-detail-controller">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            社区管理
            <small>前台用户发帖管理</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 后台首页</a></li>
            <li class="active"><a href="/bbs/lists/index">帖子列表</a></li>
            <li class="active">帖子详情</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <!-- Box Comment -->
                <div class="box box-widget">
                    <div class="box-header with-border">
                        <div class="user-block">
                            <img class="img-circle" ng-src="{{ detail.avatar ? detail.avatar : '/assets/admin/img/head.png' }}"
                                 onerror="this.src='/assets/admin/img/head.png'" alt="User Image">
                            <span class="username"><a href="#" ng-bind="detail.nickName"></a></span>
                            <span class="description" ng-bind="'发布时间 - ' + detail.created"></span>
                        </div>
                        <!-- /.user-block -->
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <p style="text-indent: 2em;" ng-bind="detail.content"></p>
                        <!-- Attachment -->
                        <div class="attachment-block clearfix"
                             ng-if="attachment && attachment.thumb && attachment.thumb.length > 0">
                            <!-- 如果图小于 3 张 -->
                            <div ng-if="attachment.thumb && attachment.thumb.length <= 3" class="row margin-bottom">
                                <div class="col-sm-4" ng-repeat="t in attachment.thumb">
                                    <img class="img-responsive" ng-src="{{ t }}" alt="Photo">
                                </div>
                            </div>

                            <!-- 如果图片为 4 - 6 张 -->
                            <div ng-if="attachment.thumb && attachment.thumb.length <= 6 && attachment.thumb.length > 3"
                                 class="row margin-bottom">
                                <div class="col-sm-2" ng-repeat="t in attachment.thumb">
                                    <img class="img-responsive" ng-src="{{ t }}" alt="Photo">
                                </div>
                            </div>

                            <!-- 如果图片为 7 - 9 张 -->
                            <div ng-if="attachment.thumb && attachment.thumb.length <= 9 && attachment.thumb.length > 6"
                                 class="row margin-bottom">
                                <div class="col-sm-4">
                                    <img class="img-responsive" ng-src="{{ attachment.thumb[0] }}" alt="Photo">
                                </div>
                                <div class="col-sm-2" ng-repeat="i in [1, 2, 3, 4]">
                                    <img class="img-responsive" ng-if="attachment.thumb[2 * i - 1]"
                                         ng-src="{{ attachment.thumb[i * 2 - 1] }}" alt="Photo">
                                    <br>
                                    <img class="img-responsive" ng-if="attachment.thumb[2 * i]"
                                         ng-src="{{ attachment.thumb[i * 2] }}" alt="Photo">
                                </div>
                            </div>
                        </div>
                        <!-- /.attachment-block -->

                        <!-- Social sharing buttons -->
                        <button ng-show="attachment.thumb.length > 0" type="button" class="btn btn-default btn-xs" ng-click="showImage()"><i
                                class="fa fa-search"></i> 查看大图
                        </button>
                        <span class="pull-right text-muted">{{ detail.likes }} 喜欢 - {{ detail.comments }} 评论</span>
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer box-comments" ng-show="comments && comments.length > 0">
                        <div class="box-comment" ng-repeat="(k, m) in comments">
                            <!-- User image -->
                            <img class="img-circle img-sm" ng-src="{{ m.avatar ? m.avatar : '/assets/admin/img/head.png' }}" onerror="this.src='/assets/admin/img/head.png'" alt="User Image">
                            <div class="comment-text">
                                <span class="username">
                                    {{ m.nickName }}
                                    <span class="text-muted pull-right">评论时间: {{ m.created }} &nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-trash" ng-click="trushComment(m.commentId, k)"></i></span>
                                </span><!-- /.username -->
                                <p ng-bind="m.text" style="padding-bottom: 10px; border-bottom: 1px solid #eeeeee;"></p>
                                <div class="box-comment" ng-show="m.reply && m.reply.replyId">
                                    <!-- User image -->
                                    <img class="img-circle img-sm" ng-src="{{ m.reply.avatar ? m.reply.avatar : '/assets/admin/img/head.png' }}" onerror="this.src='/assets/admin/img/head.png'" alt="User Image">
                                    <div class="comment-text">
                                        <span class="username">
                                            {{ m.reply.nickName }}
                                            <span class="text-muted">回复: {{ m.created }} &nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-trash" ng-click="trushReply(m.reply.replyId, k)"></i></span>
                                        </span><!-- /.username -->
                                        <p ng-bind="m.reply.content"></p>
                                    </div>
                                    <!-- /.comment-text -->
                                </div>
                            </div>
                            <!-- /.comment-text -->
                        </div>
                        <!-- /.box-comment -->
                    </div>

                    <div class="box-footer box-comments text-center" ng-show="comments && comments.length == 0">
                        暂无评论
                    </div>

                    <!-- /.box-footer -->
                    <div class="box-footer" style="text-align: center; padding: 20px 0;" ng-show="commentsNextPage">
                        <button class="btn btn-link load-more" ng-click="loadMoreComments()">加载更多</button>
                    </div>
                    <!-- /.box-footer -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
    </section>
    <!-- /.content -->


    <div class="modal" id="imageModal" ng-show="attachment.org && attachment.org.length > 0">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="row">
                    <div class="col-md-12">
                        <div class="box box-solid">
                            <div class="box-header with-border">
                                <h3 class="box-title">图片展示</h3>
                            </div>
                            <!-- /.box-header -->
                            <div class="box-body">
                                <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
                                    <div class="carousel-inner">
                                        <div class="item" ng-class="{'active': $index == 0}"
                                             ng-repeat="($index, i) in attachment.org">
                                            <img ng-src="{{ i }}" alt="">
                                        </div>
                                    </div>
                                    <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
                                        <span class="fa fa-angle-left"></span>
                                    </a>
                                    <a class="right carousel-control" href="#carousel-example-generic"
                                       data-slide="next">
                                        <span class="fa fa-angle-right"></span>
                                    </a>
                                </div>
                            </div>
                            <!-- /.box-body -->
                        </div>
                        <!-- /.box -->
                    </div>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>


</div>
<!-- /.content-wrapper -->
<?php $this->load->view('admin/public/foot.html', array('js' => array('/assets/admin/js/bbs/detail.js'))); ?>
